package com.sec.android.app.myfiles.module.shortcut;

import android.content.Context;
import android.net.Uri;

import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.util.SemFwWrapper;
import com.sec.android.app.myfiles.util.StorageMonitor;

import java.io.File;

public class ShortcutFileRecord extends FileRecord {

    public ShortcutFileRecord() {
        mStorageType = StorageType.Shortcut;
    }

    public ShortcutFileRecord(String realFullPath, String displayName, int fileType) {
        mStorageType = StorageType.Shortcut;
        mPath = realFullPath;
        mName = displayName;
        mFileType = fileType;
    }

    @Override
    public String getFullPath() {
        return mPath;
    }

    @Override
    public String getDisplayName(Context context) {
        return mName;
    }

    @Override
    public boolean isRoot() {
        return true;
    }

    @Override
    protected int _getId() {
        return 0;
    }

    @Override
    protected Uri _getUri(Context context) {
        return null;
    }

    @Override
    public boolean exists(Context context) {
        boolean exist = false;

        int storageType = StorageMonitor.getMatchedStorageType(getFullPath());
        if (StorageMonitor.isStorageMounted(context, storageType)) {
            File srcFile = SemFwWrapper.file(getFullPath());
            exist = srcFile.exists();
        }
        return exist;
    }
}
